public with sharing class BILoginController {

    public String url {get; private set;}
    public Boolean isErr {get; private set;}
    public BILoginController() {}

    public void  Login(){
        url = '';
    	User u = [select Id, EmployeeNumber from User  where Id =: UserInfo.getUserId()];
        if(u.EmployeeNumber == null)  {

           setErr( '请维护您的工号!');
        	return  ; 
        }
        String emNumber = null ;
        try {
           emNumber =  u.EmployeeNumber.replaceFirst('^0+', '');
        }catch (Exception e) {
           setErr('解析工号错误:'+e.getMessage());
            return ; 
        }
        webservicesCfWeaverComCn.PwdServiceHttpPort fwoaUtil = new webservicesCfWeaverComCn.PwdServiceHttpPort();

		String pwd = '';
		if(Test.isRunningTest()){
             Test.setMock(WebServiceMock.class, new FWOATCWebserviceMockImpl());
             pwd = '1';
             pwd = '1';
             pwd = '1';
             pwd = '1';
         }else{
			pwd = fwoaUtil.getPwd(emNumber);
         }
		 url = 'https://bi.maccura.com:7500/bi/esmain/login.do?id='+emNumber+'&pw='+pwd+'&url=/bi/esmain/portal/portal.do?id=DHSFG';
    	if(System.Test.isRunningTest())setErr('134');

    }
    private void setErr(String message){
        isErr = true; 
        ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, message));
    }

}